﻿using MyCompany.MyProject.Model.Models.RootKey;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCompany.MyProject.Model.Models
{
    /// <summary>
    /// 用户信息表
    /// </summary>
    public class SysUserInfo:RootEntityTKey<long>, IDeleteFilter
    {
        /// <summary>
        /// 登录账号
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = true, ColumnDescription = "登录账号")]
        public string? LoginName { get; set; }

        /// <summary>
        /// 登录密码
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = true)]
        public string? LoginPWD { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = true)]
        public string? RealName { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        public bool IsDelete { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int Status { get; set; } = 0;

        /// <summary>
        /// 部门
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public long DepartmentId { get; set; } = -1;

        /// <summary>
        /// 备注
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = true)]
        public string? Remark { get; set; }


        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 关键业务修改时间
        /// </summary>
        public DateTime CriticalModifyTime { get; set; } = DateTime.Now;

        /// <summary>
        ///最后异常时间 
        /// </summary>
        public DateTime LastErrorTime { get; set; } = DateTime.Now;

        /// <summary>
        ///错误次数 
        /// </summary>
        public int ErrorCount { get; set; } = 0;


        /// <summary>
        /// 登录账号
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = true)]
        public string? Name { get; set; }

        /// <summary>
        /// 性别
        /// </summary>        
        [SugarColumn(IsNullable = true)]
        public int Sex { get; set; } = 0;

        /// <summary>
        ///  年龄
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public int Age { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public DateTime Birth { get; set; } = DateTime.Now;

        /// <summary>
        /// 地址
        /// </summary>
        [SugarColumn(Length = 200, IsNullable = true)]
        public string? Address { get; set; }

        /// <summary>
        /// 是否启用
        /// </summary>
        [SugarColumn(DefaultValue = "1")]
        public bool Enable { get; set; } = true;

        /// <summary>
        /// 是否删除
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public bool? IsDeleted { get; set; } = false;

        /// <summary>
        /// 租户Id
        /// </summary>
        [SugarColumn(IsNullable = false, DefaultValue = "0")]
        public long TenantId { get; set; }

        /// <summary>
        /// 角色名称
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<string>? RoleNames { get; set; }

        /// <summary>
        /// 部门ID集合
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<long>? Dids { get; set; }

        /// <summary>
        /// 部门
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string? DepartmentName { get; set; }

        /// <summary>
        /// 角色ID集合
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public List<long>? RIDs { get; set; }
    }
}
